import 'dart:math';

import 'package:flutter/material.dart';
import 'package:myturngame/Theme.dart';
import 'package:myturngame/facotry/bag_object_factory.dart';
import 'package:myturngame/bean/bagobject/equipment.dart';
import 'package:myturngame/bean/message.dart';
import 'package:myturngame/facotry/equipment_factory.dart';
import 'package:myturngame/main.dart';

import '../common/game_global.dart';

///调试对话框
class DebugDialog extends StatefulWidget {
  Function(Message) messageAdd;
  DebugDialog(this.messageAdd,{Key? key}) : super(key: key);

  @override
  State<DebugDialog> createState() => _DebugDialogState();
}

class _DebugDialogState extends State<DebugDialog> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 500,
      padding: const EdgeInsets.all(10),
      child: Column(
        children: [
          OutlinedButton(
              onPressed: () {
                int expValue = 10;
                GameGlobal.player.addExp(expValue);
                widget.messageAdd(Message.text("获得$expValue点经验值"));
              },
              child: const Text("增加经验10", style: textStyle2)),
          OutlinedButton(
              onPressed: () {
                var equip = createEquipment("equip013");
                GameGlobal.player.bag.putIn(equip);
                widget.messageAdd(Message.object(equip));
              },
              child: const Text("获得神之剑", style: textStyle2)),
          OutlinedButton(
              onPressed: () {
                var objects = [
                  createEquipment("equip001"),
                  createEquipment("equip002"),
                  createEquipment("equip003"),
                  createEquipment("equip004")
                ];
                for(var object in objects){
                  GameGlobal.player.bag.putIn(object);
                  widget.messageAdd(Message.object(object));
                }
              },
              child: const Text("获得散件", style: textStyle2)),
          OutlinedButton(
              onPressed: () {
                var suits = [
                  createSkill001Suit1(),
                  createSkill001Suit2(),
                  createSkill001Suit3(),
                  createSkill001Suit4(),
                ];
                for(var suit in suits){
                  GameGlobal.player.bag.putIn(suit);
                  widget.messageAdd(Message.object(suit));
                }
              },
              child: const Text("获得横扫套装", style: textStyle2)),
          OutlinedButton(
              onPressed: () {
                var suits = [
                  createSkill002Suit1(),
                  createSkill002Suit2(),
                  createSkill002Suit3(),
                  createSkill002Suit4(),
                ];
                for(var suit in suits){
                  GameGlobal.player.bag.putIn(suit);
                  widget.messageAdd(Message.object(suit));
                }
              },
              child: const Text("获得猛击套装", style: textStyle2)),
        ],
      ),
    );
  }
}
